package com.mayikt;

/**
 * @Author: maplefire
 * @Description: join方法示例
 * @Date: 2022/06/16 18:27
 */

public class ThreadDemo05 {
    public static void main(String[] args) {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 60; i++) {
                    System.out.println("子线程,i:" + i);
                }
            }
        });
        t1.start();
        // 主线程让子线程先执行完毕
        try {
            t1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        for (int i = 0; i < 30; i++) {
            System.out.println("主线程,i:" + i);
        }
    }
}
